import 'package:ayj_flutter_chat_app/database/group_list/group_info_db.dart';
import 'package:floor/floor.dart';

@dao
abstract class GroupListDao {
  @Query('SELECT * FROM GroupList')
  Future<List<GroupInfoDb>> findAllContacts();

  @Query('SELECT * FROM GroupList WHERE groupId = :id')
  Future<GroupInfoDb?> findContactById(String id);

  @Query('DELETE FROM GroupList') // 清空表
  Future<void> deleteAllGroupList();

  @insert
  Future<void> insertGroup(GroupInfoDb group);

  @insert
  Future<void> insertGroupList(List<GroupInfoDb> groups);

  @update
  Future<void> updateGroup(GroupInfoDb group);

  @delete
  Future<void> deleteGroup(GroupInfoDb group);
}
